<style>
    .layui-iconpicker-body.layui-iconpicker-body-page .hide {
        display: none;
    }
</style>
<link rel="stylesheet" href="/static/plugs/lay-module/autocomplete/autocomplete.css?v={$version}" media="all">
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">

        <!-- <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" id="title" name="title" class="layui-input" lay-reqtext="请输入标题" placeholder="请输入标题" value="{$row.title|default=''}">
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">OCR方式</label>
            <div class="layui-input-block">
                <input type="radio" name="ocr_type" value="0" title="阿里" lay-filter="ocr_type" {if $row.ocr_type==0}checked{/if}>
                <input type="radio" name="ocr_type" value="1" title="百度" lay-filter="ocr_type" {if $row.ocr_type==1}checked{/if}>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">公司</label>
            <div class="layui-input-block">
                <select id="company_id" name="company_id" lay-reqtext="请选择公司" data-select="{:url('insurance.company/index')}" data-fields="id,name"  data-value="{$row.company_id|default=''}"></select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">保单类型</label>
            <div class="layui-input-block">
                <input type="radio" name="p_type" value="1" title="商业险" lay-filter="p_type" {if $row.p_type==1}checked{/if}>
                <input type="radio" name="p_type" value="0" title="交强险" lay-filter="p_type" {if $row.p_type==0}checked{/if}>
                <input type="radio" name="p_type" value="2" title="驾乘险" lay-filter="p_type" {if $row.p_type==2}checked{/if}>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">识别字段</label>
            <div class="layui-input-block">
                <select id="p_key" name="p_key" lay-reqtext="请选择字段" data-value="">
                    {volist name="p_titles" id="vo"}
                    <option value="{$key}" {if $row.p_key==$key}selected{/if}>{$vo}</option>
                    {/volist}
                </select>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">关键字识别方式</label>
            <div class="layui-input-block">
                <input type="radio" name="type" value="0" title="全等" lay-filter="type" {if $row.type==0}checked{/if}>
                <input type="radio" name="type" value="1" title="包含" lay-filter="type" {if $row.type==1}checked{/if}>
                <input type="radio" name="type" value="2" title="正则" lay-filter="type" {if $row.type==2}checked{/if}>
            </div>
        </div>
                
        <div class="layui-form-item  {if $row.type==2}layui-hide{/if}" id="keyword_div">
            <label class="layui-form-label">关键字</label>
            <div class="layui-input-block">
                <input type="text" id="keyword" name="keyword" class="layui-input" lay-reqtext="请输入关键字" placeholder="请输入关键字" value="{$row.keyword|default=''}">
            </div>
        </div>
 
        <div class="layui-form-item  {if $row.type!=2}layui-hide{/if}" id="reg_div">
            <label class="layui-form-label">正则表达式</label>
            <div class="layui-input-block">
                <input type="text" id="reg" name="reg" class="layui-input" lay-reqtext="请输入正则表达式" placeholder="请输入正则表达式" value="{$row.reg|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">提取内容所在行</label>
            <div class="layui-input-block">
                <input type="number" min="0" id="content_row_num" name="content_row_num" class="layui-input" lay-reqtext="请输入提取内容所在行" placeholder="请输入提取内容所在行" value="{$row.content_row_num|default=0}">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label">是否需要替换</label>
            <div class="layui-input-block">
                <input type="radio" name="is_rep" value="0" title="否" lay-filter="is_rep" {if $row.is_rep==0}checked{/if}>
                <input type="radio" name="is_rep" value="1" title="是" lay-filter="is_rep" {if $row.is_rep==1}checked{/if}>
            </div>
        </div>

        <div class="layui-form-item {if $row.is_rep==0}layui-hide{/if}" id="content_replace_div">
            <label class="layui-form-label">提取内容替换</label>
            <div class="layui-input-block" id="content_replace">
                {volist name="row.content_rep_rule" id="vo"}
                <div class="content_replace_item" style="margin-bottom: 5px;">
                    <div class="layui-input-inline">
                        <input type="text" id="" name="sou[]" lay-verify="required" class="layui-input" lay-reqtext="请输入被替换内容" placeholder="请输入被替换内容" value="{$vo.sou}">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" id="" name="rep[]" class="layui-input" lay-reqtext="请输入替换内容" placeholder="请输入替换内容" value="{$vo.rep}">
                    </div>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-sm " lay-active="delete_content_replace_item" style="height: 38px;">删除</button>
                </div>
                {/volist}
            </div>
            <div class="layui-input-block">
                <button type="button" lay-active="add_content_replace_item" class="layui-btn layui-btn-normal layui-btn-sm">添加</button>
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>

<template id="content_replace_item_tpl">
    <div>
        <div class="content_replace_item" style="margin-bottom: 5px;">
            <div class="layui-input-inline">
                <input type="text" id="" name="sou[]" lay-verify="required" class="layui-input" lay-reqtext="请输入被替换内容" placeholder="请输入被替换内容" value="">
            </div>
            <div class="layui-input-inline">
                <input type="text" id="" name="rep[]" class="layui-input" lay-reqtext="请输入替换内容" placeholder="请输入替换内容" value="">
            </div>
            <button type="button" class="layui-btn layui-btn-danger layui-btn-sm " lay-active="delete_content_replace_item" style="height: 38px;">删除</button>
        </div>
    </div>
</template>